﻿ 
using System.Web.Mvc;
using CarTrackr.Business;
using CarTrackr.Business.Validation;

namespace CarTrackr.Controllers
{
    public static class ControllerExtensions
    {

        public static void UpdateWithViolation( this ModelStateDictionary modelState, BusinessBase businessBase)
        {
            foreach (Rule rule in businessBase.BrokenRules.Values)
            {
                modelState.AddModelError(rule.RuleKey, rule.Text);
            }

        }
    }
}
